Function Reference

_TempFile

Generate a name for a temporary file. The file is guaranteed not to exist yet.

#include <File.au3>
_TempFile ( [$s_DirectoryName=@TempDIr [, $s_FilePrefix [, $s_FileExtension [, $i_RandomLength]]]] )

 

Parameters

$s_DirectoryName Optional: Name of directory for filename, defaults to the users %TEMP% directory
$s_FilePrefix Optional: File prefixname, defaults to "~"
$s_FileExtension Optional: File extenstion, defaults to ".tmp"
$i_RandomLength Optional: Number of characters to use to generate a unique name, defaults to 7

 

Return Value

Filename of a temporary file which does not exist

 

Remarks

None.

 

Related

None.

 

Example


#include <File.au3>

Dim $s_TempFile, $s_FileName

; generate unique filename in @TempDir
$s_TempFile = _TempFile()

; generate unique filename in given directory and starting with tst_
$s_FileName = _TempFile("C:\", "tst_", ".txt", 7)

MsgBox(4096, "Info", "Names suitable for new temporary file : " & @LF & $s_TempFile & @LF & $s_FileName)

Exit